package com.monitoring.application.dto;

import lombok.Data;
import java.time.LocalDateTime;

@Data
public class DeviceDTO {
    private Long id;
    private String name;
    private String type;
    private String location;
    private boolean active;
    private boolean poweredOn;
    private String status;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
    
    // 空调特有属性
    private Integer temperature;
    private String mode;
    private Integer fanSpeed;
    private Boolean energySavingMode;
    
    // 电表特有属性
    private Double currentReading;
    private Double totalConsumption;
    private Double powerFactor;
    private Double voltage;
    private Double current;
    
    // 用于创建新空调的静态方法
    public static DeviceDTO createAirConditioner(String name, String location) {
        DeviceDTO dto = new DeviceDTO();
        dto.setName(name);
        dto.setType("AIR_CONDITIONER");
        dto.setLocation(location);
        dto.setActive(true);
        dto.setStatus("正常");
        dto.setTemperature(25);
        dto.setMode("制冷");
        dto.setFanSpeed(2);
        return dto;
    }
    
    // 用于创建新电表的静态方法
    public static DeviceDTO createElectricMeter(String name, String location) {
        DeviceDTO dto = new DeviceDTO();
        dto.setName(name);
        dto.setType("ELECTRIC_METER");
        dto.setLocation(location);
        dto.setActive(true);
        dto.setStatus("正常");
        dto.setCurrentReading(0.0);
        dto.setTotalConsumption(0.0);
        return dto;
    }
}